import numpy as np
import cv2 as cv
from Config import img_path

cv.namedWindow('image')
img = cv.imread(img_path)
px = img[100,100]
print( px )
# accessing only blue pixel 蓝色、绿色、红色
blue = img[100,100,0]
print( blue )

#  Better pixel accessing and editing method :accessing RED value
img.item(10,10,2)
# Better pixel accessing and editing method : modifying RED value
img.itemset((10,10,2),100)
img.item(10,10,2)

ball = img[280:340, 330:390]
img[273:333, 100:160] = ball

cv.imshow('image', img)

cv.waitKey(0)
